package com.wsl.HealthChallenge.models;

/**
 * An enumeration for supported contest types, such as "calories burned" or "steps taken".
 * It also stores the corresponding Google Health tracker name, as well as a long and short
 * string for the unit, e.g. "steps" and "steps taken".
 *  
 * @author mark
 */
public enum ContestType {
    CALORIES_BURNED("calories_burned", "Calories burned", "calories burned", "calories"),
    STEPS_TAKEN("steps_taken", "Steps taken", "steps taken", "steps");

    public final String stringRepresentation;
    public final String googleHealthTracker;
    public final String displayName;
    public final String shortDisplayName;

    private ContestType(
            String stringRepresentation,
            String googleHealthTracker,
            String displayName,
            String shortDisplayName) {
        this.stringRepresentation = stringRepresentation;
        this.googleHealthTracker = googleHealthTracker;
        this.displayName = displayName;
        this.shortDisplayName = shortDisplayName;
    }

    static public ContestType getFromStringRepresentation(String stringRepresentation) {
        for (ContestType contestType : ContestType.values()) {
            if (contestType.stringRepresentation.equals(stringRepresentation)) {
                return contestType;
            }
        }
        return CALORIES_BURNED;
    }
}